#!/usr/bin/env python
# -*- coding: utf-8 -*-

"Fact Class mapping to SQL table"

from django.db import models
from labman2.data.models import Base


#==============================================================================
class Fact(Base):
    "A string of text, the simplest data entry"


    help_text = "Plain text (special chars are escaped in HTML)"
    name = models.TextField(null=True, blank=True, default=None,
                            help_text=help_text)
    description = models.TextField(help_text=help_text)

    def __unicode__(self):

        return u'%s: %s :%s' % (
            self.name, self.description[:16], Base.__unicode__(self))

    def show_details(self):
        "A long representation"

        info_dict = [('Name', self.name), ('Description', self.description)]
        info_dict.extend(Base.show_details(self))
        return info_dict
